package io;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * @author Huangjin
 * @version 1.0
 * describe:读取文本数据
 * @date 2023/3/7 17:03
 */
public class ReadStringDemo {
    public static void main(String[] args) throws IOException {
        File file = new File("fos.txt");
        FileInputStream fis = new FileInputStream(file);
        byte[] data= new byte[(int)file.length()];
        fis.read(data);
        String line =  new String(data, StandardCharsets.UTF_8);
        System.out.println(line);
        fis.close();
    }
}
